#ifndef __YH__STASH_SRC_LIBS_YHEPOLL_DAEMON_INIT_H__
#define __YH__STASH_SRC_LIBS_YHEPOLL_DAEMON_INIT_H__

#include <syslog.h>
#include <unistd.h>
#include <fcntl.h>

#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>

#include "yherror.h"

#ifdef __cplusplus
extern "C"
{
#endif

#pragma pack(push)
#pragma pack(1)
#pragma pack(pop)

// If chdir_root != zero, daemoninit() changes the calling process's
// current working directory to  the  root  directory ("/");
//      otherwise, the current working directory is left unchanged.
// If  close_012 != zero, daemoninit() redirects standard input,
// standard output and standard error to /dev/null;
//      otherwise, no changes are made to these file descriptors.
void daemoninit(const char *pname, int facility, int chdir_root, int close_012);


#ifdef __cplusplus
}
#endif
#endif /* __YH__STASH_SRC_LIBS_YHEPOLL_DAEMON_INIT_H__ */
